if (localStorage.getItem("login") == 'false') {
    console.log(111);
    var acc = localStorage.getItem("user");
    $('#dl').html(acc)
}
let tc=document.getElementById("tc")
let aa=document.getElementById("dl")

let zc = document.getElementById("zc")
console.log(zc);
console.log(localStorage.getItem("login"));
function name1() {
    if(localStorage.getItem("login")!=false){
        zc.style.display = "none";
        tc.style.display="block";
    }else{
        zc.style.display ="block"
    }
    
}

name1()
tc.onclick=function(){
    dl.style.display="none";
    zc.style.display="block";
}
// 轮播图
var swiper = new Swiper(".mySwiper", {
    loop: true,//最后一页第一页切换
    autoplay:true,//设置自动播放
    spaceBetween: 30,
    effect: "fade",
    navigation: {
        nextEl: ".swiper-button-next",
        prevEl: ".swiper-button-prev",
    },
    pagination: {
        el: ".swiper-pagination",
        clickable: true,
    },
});


$(function(){
    // 下载app
    $('#apps').hover(function(){
        $('#app').stop().slideToggle()
    });
    // 购物车
    $('#cart').hover(function(){
        console.log(123);
        $('#cars').stop().slideToggle()
        
        
    //调购物车数据
    

    });
    // hotgoods
    $('.mainbav-list li').hover(function(){
        $(this).find('div').stop().slideToggle()
    });
    
})
// 登录之后添加用户账号
if (localStorage.getItem("login") == 'true') {
    console.log(111);
    var acc = localStorage.getItem("username");
    $('#login').html(acc)
}

$.ajax({
    url: "http://jx.xuzhixiang.top/ap/api/cart-list.php",
    type: "get",
    data: {
        id: localStorage.getItem("id"),
        
        
    },
    success: function (data) {
        
        console.log(data);
        let str=""
        for(let key in data.data){
            str+=`
        
        <img src="${data.data[key].pimg}">
        <p class="pname">${data.data[key].pname}</p>
        <p>${data.data[key].pprice}</P>
        <p>${data.data[key].pnum}</P>
       
         `
        } 
        
        
       
      $("#cars").html(str)
    }
   
})

console.log("姬寅飞")

